package com.ycy.dubbo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
@SpringBootApplication
/*
  开启 EurekaClient 功能 据说高版本现在不用主动声明，加了maven依赖就行
  @EnableEurekaClient只适用于Eureka作为注册中心，@EnableDiscoveryClient 可以是其他注册中心。
  @EnableDiscoveryClient
*/

@EnableFeignClients
public class EurekaConsumerSpringApplication extends SpringBootServletInitializer {

  public static void main(String[] args) {
    SpringApplication.run(EurekaConsumerSpringApplication.class, args);
  }

  @Override
  protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(this.getClass());
  }

  @Bean
  @LoadBalanced
  public RestTemplate get() {
    return new RestTemplate();
  }

}
